package com.aistar.service.impl;

import com.aistar.mapper.ClubActivityMapper;
import com.aistar.mapper.ClubMemberMapper;
import com.aistar.mapper.MemberMapper;
import com.aistar.pojo.*;
import com.aistar.service.ClubdetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional
public class ClubdetailsServiceImpl implements ClubdetailsService {

    @Autowired
    private ClubActivityMapper clubActivityMapper;
    @Autowired
    private ClubMemberMapper clubMemberMapper;
    @Autowired
    private MemberMapper memberMapper;
    @Autowired
    private ClubdetailsService clubdetailsService;

    @Override
    public ClubActivity selectByPrimaryKey(Integer clubId) {

        return clubActivityMapper.selectByPrimaryKey(clubId);
    }

    @Override
    public List<Integer> selectByClubId(Integer clubId) {
        return clubMemberMapper.selectByClubId(clubId);
    }

    @Override
    public Member selectByUserId(Integer id) {
        Member member = memberMapper.selectByPrimaryKey(id);
        return member;
    }

    @Override
    public void sava(ClubMember clubMember) {
        clubMemberMapper.insert(clubMember);
    }

    @Override
    public List<ClubMember> selectByClubIdFindMember(Integer clubId) {
        return clubMemberMapper.selectByClubIdFindMember(clubId);
    }

    @Override
    public ClubActivity selectByClubIdFindPrice(Integer clubId) {
        return clubActivityMapper.selectByPrimaryKey(clubId);
    }

    @Override
    public void updateNumber(Integer club_number, Integer club_id) {
        clubMemberMapper.updateNumber(club_number,club_id);
    }

    @Override
    public void updateCost(Float club_member_cost, Integer club_id) {
        clubMemberMapper.updateCost(club_member_cost,club_id);
    }
    @Override
    public Integer selectCount(Integer clubId) {
        return clubMemberMapper.selectCountUser(clubId);
    }

}
